Skip to content

use a tuple for function arguments #4321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2019
Merged

use a tuple for function arguments #4321

merged 1 commit into from
Mar 4, 2019

Conversation

kroening
Copy link
Member

@kroening kroening commented Mar 4, 2019

This is follow-up from PR #4317.

This introduces tuple_exprt.

function_application_exprt now uses tuple_exprt for the argument operand,
instead of an expression with empty ID.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

This is follow-up from PR #4317.

This introduces tuple_exprt.

function_application_exprt now uses tuple_exprt for the argument operand,
instead of an expression with empty ID.
@@ -186,6 +186,15 @@ inline void validate_expr(const factorial_power_exprt &value)
validate_operands(value, 2, "Factorial power must have two operands");
}

class tuple_exprt : public multi_ary_exprt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth moving this to std_expr.h and use it in those places where we currently do use ID_arguments?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively I would suggest putting all the .*_exprt classes in a new module (separate from util) and have one class per header file, but that's a much bigger change.

Copy link
Collaborator

@tautschnig tautschnig Mar 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea, but this is a very intrusive change -- a lot of code in util already depends on std_expr.h:

$ git grep 'include.*std_expr.h' src/util/ | wc -l
43

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the arguments/parameters of a C/C++ function are a very different thing from the arguments/parameters of a mathematical function. In particular, there is no tuple building going on in C/C++ or Java.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Copy link
Member Author

@kroening kroening Mar 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romainbrenguier getting slightly off-topic, we could separate the 'irep/expression' related things from the 'non irep utilities', say making a directory named "irep". There could be dummy headers for a transition period.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that sounds good

@tautschnig tautschnig assigned kroening and unassigned tautschnig Mar 4, 2019
@tautschnig tautschnig merged commit 6f1ceb9 into develop Mar 4, 2019
@tautschnig tautschnig deleted the tuple_exprt branch March 4, 2019 16:14
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: a8e67cb).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/103063401
Status will be re-evaluated on next push.
Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)

  • the author is not in the list of contributors (e.g. first-time contributors).

  • the compatibility was already broken by an earlier merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants